const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.BIGINT.UNSIGNED,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "自增id",
      field: "id"
    },
    user_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "用户id",
      field: "user_id"
    },
    system_type: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "default",
      primaryKey: false,
      autoIncrement: false,
      comment: "系统类型（默认 default, 其他按照SYSTEM_TYPE常量类型）",
      field: "system_type"
    },
    platform: {
      type: DataTypes.CHAR(30),
      allowNull: false,
      defaultValue: "pc",
      primaryKey: false,
      autoIncrement: false,
      comment: "所属平台（pc PC网站, h5 H5手机网站, ios 苹果APP, android 安卓APP, alipay 支付宝小程序, weixin 微信小程序, baidu 百度小程序, toutiao 头条小程序, qq QQ小程序, kuaishou 快手小程序）",
      field: "platform"
    },
    token: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "token",
      field: "token"
    },
    alipay_openid: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "支付宝openid",
      field: "alipay_openid"
    },
    weixin_openid: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "微信openid",
      field: "weixin_openid"
    },
    weixin_unionid: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "微信unionid",
      field: "weixin_unionid"
    },
    weixin_web_openid: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "微信web用户openid",
      field: "weixin_web_openid"
    },
    baidu_openid: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "百度openid",
      field: "baidu_openid"
    },
    toutiao_openid: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "百度openid",
      field: "toutiao_openid"
    },
    toutiao_unionid: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "头条unionid",
      field: "toutiao_unionid"
    },
    qq_openid: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "QQopenid",
      field: "qq_openid"
    },
    qq_unionid: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "QQunionid",
      field: "qq_unionid"
    },
    kuaishou_openid: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "快手openid",
      field: "kuaishou_openid"
    },
    add_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "添加时间",
      field: "add_time"
    },
    upd_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "更新时间",
      field: "upd_time"
    }
  };
  const options = {
    tableName: "sxo_user_platform",
    comment: "",
    indexes: [{
      name: "user_id",
      unique: false,
      type: "BTREE",
      fields: ["user_id"]
    }, {
      name: "system_type",
      unique: false,
      type: "BTREE",
      fields: ["system_type"]
    }, {
      name: "platform",
      unique: false,
      type: "BTREE",
      fields: ["platform"]
    }, {
      name: "token",
      unique: false,
      type: "BTREE",
      fields: ["token"]
    }, {
      name: "alipay_openid",
      unique: false,
      type: "BTREE",
      fields: ["alipay_openid"]
    }, {
      name: "weixin_openid",
      unique: false,
      type: "BTREE",
      fields: ["weixin_openid"]
    }, {
      name: "weixin_unionid",
      unique: false,
      type: "BTREE",
      fields: ["weixin_unionid"]
    }, {
      name: "weixin_web_openid",
      unique: false,
      type: "BTREE",
      fields: ["weixin_web_openid"]
    }, {
      name: "baidu_openid",
      unique: false,
      type: "BTREE",
      fields: ["baidu_openid"]
    }, {
      name: "toutiao_openid",
      unique: false,
      type: "BTREE",
      fields: ["toutiao_openid"]
    }, {
      name: "toutiao_unionid",
      unique: false,
      type: "BTREE",
      fields: ["toutiao_unionid"]
    }, {
      name: "qq_openid",
      unique: false,
      type: "BTREE",
      fields: ["qq_openid"]
    }, {
      name: "qq_unionid",
      unique: false,
      type: "BTREE",
      fields: ["qq_unionid"]
    }, {
      name: "kuaishou_openid",
      unique: false,
      type: "BTREE",
      fields: ["kuaishou_openid"]
    }]
  };
  const SxoUserPlatformModel = sequelize.define("sxo_user_platform_model", attributes, options);
  return SxoUserPlatformModel;
};